8661114754daa5b2e1b9ab505d72d8d1a691169d,aaa-h2-store/src/main/java/org/opendaylight/aaa/h2/persistence/GrantStore.java,GrantStore,getGrant,#String#,164
Before Change
try {
PreparedStatement pstmt = conn
.prepareStatement("SELECT * FROM GRANTS WHERE grantid = ? ");
pstmt.setString(1, id);
LOG.debug("query string: ", pstmt.toString());
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
Grant grant = rsToGrant(rs);
rs.close();
pstmt.close();
return grant;
} else {
rs.close();
pstmt.close();
return null;
}
} catch (SQLException s) {
throw new StoreException("SQL Exception : " + s);
After Change
protected Grant getGrant(String id) throws StoreException {
try (Connection conn = dbConnect();
PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM GRANTS WHERE grantid = ? ")) {
pstmt.setString(1, id);
LOG.debug("query string: ", pstmt.toString());
return firstFromStatement(pstmt);
} catch (SQLException s) {